# -*- coding: utf-8 -*-
"""
Date: 2021-10-18
Author: J z
"""
from framework.dal.chaosmodel.models import BaseChaosModel
from framework.dal.datasource import datasource_register, CrossFishActivityDatasource
from framework.dal.orm import models


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishSceneAwardCfg(BaseChaosModel):
    TemplateId = models.IntegerField(primary_key=True)
    MapId = models.IntegerField(primary_key=True)
    SceneId = models.IntegerField(primary_key=True)
    AwardList = models.CharField(default="[]", max_length=255)


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishActiveCfg(BaseChaosModel):
    TemplateId = models.IntegerField(primary_key=True)
    StageId = models.IntegerField(primary_key=True)
    ActivityScore = models.IntegerField()
    FreeAwardList = models.CharField(default="[]", max_length=255)
    SpecialAwardList = models.CharField(default="[]", max_length=255)


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishStoryCfg(BaseChaosModel):
    TemplateId = models.IntegerField(primary_key=True)
    StoryId = models.IntegerField(primary_key=True)
    RightAwardList = models.CharField(default="[]", max_length=500)
    WrongAwardList = models.CharField(default="[]", max_length=500)


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishActivity(BaseChaosModel):
    ActivityId = models.CharField(max_length=32, primary_key=True)
    TemplateId = models.IntegerField()
    StartTime = models.DateTimeField(default="2010-01-01 00:00:00")
    EndTime = models.DateTimeField(default="2010-01-01 00:00:00")
    AwardEndTime = models.DateTimeField(default="2010-01-01 00:00:00")
    OpenTime = models.CharField(default="[]", max_length=50)
    ActivityStatus = models.IntegerField(default=1)
    PersonRangeList = models.CharField(default="[]", max_length=255)
    PersonAwardList = models.CharField(default="[]", max_length=3400)
    PersonExtraScoreList = models.CharField(default="[]", max_length=255)
    PersonExtraAwardList = models.CharField(default="[]", max_length=1700)
    ActiveRangeList = models.CharField(default="[]", max_length=255)
    ActiveAwardList = models.CharField(default="[]", max_length=3400)
    ActiveExtraScoreList = models.CharField(default="[]", max_length=255)
    ActiveExtraAwardList = models.CharField(default="[]", max_length=1700)
    OpenMapDict = models.CharField(default="{}", max_length=1024)
    ServerList = models.CharField(default="[]", max_length=255)
    ActivityAlliesStatus = models.IntegerField(default=1)
    ServerAlliesDict = models.CharField(default="{}", max_length=127)
    CreateTime = models.DateTimeField(default="2010-01-01 00:00:00")


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishRole(BaseChaosModel):
    ActivityId = models.CharField(max_length=32, primary_key=True)
    RoleGuid = models.CharField(max_length=32, primary_key=True)
    ServerId = models.IntegerField(default=1)
    AlliesId = models.CharField(indexed=True, max_length=32, default="")
    CountryId = models.IntegerField(indexed=True, default=0)
    AuthLv = models.IntegerField(default=0)
    CharacterId = models.IntegerField(default=0)
    Vit = models.IntegerField(default=0)
    VitBuyTimes = models.IntegerField(default=0)
    MaxPersonScore = models.IntegerField(default=0)
    ActivePersonScore = models.IntegerField(default=0)
    ActiveFreeAwardStatus = models.CharField(default="[]", max_length=255)
    ActiveSpecialAwardStatus = models.CharField(default="[]", max_length=255)
    IsGetPersonAward = models.IntegerField(default=0)
    IsGetTotalAward = models.IntegerField(default=0)
    PersonTaskStatus = models.CharField(default="{}", max_length=255)
    AlliesTaskStatus = models.CharField(default="{}", max_length=255)
    PassMapAwardStatus = models.CharField(default="{}", max_length=255)
    MapDict = models.CharField(default="{}", max_length=255)
    LastRefreshVitTime = models.DateTimeField(default="2010-01-01 00:00:00")
    LastEnterTime = models.DateTimeField(default="2010-01-01 00:00:00")
    ShopBuyStat = models.CharField(default="{}", max_length=1023)
    ShopRefreshTime = models.DateTimeField(default="2010-01-01 00:00:00")
    CreateTime = models.DateTimeField(default="2010-01-01 00:00:00")


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishMapRole(BaseChaosModel):
    ActivityId = models.CharField(max_length=32)
    MapUuid = models.CharField(max_length=32, primary_key=True)
    RoleGuid = models.CharField(max_length=32)
    MapId = models.IntegerField()
    StageId = models.IntegerField()
    MapInfo = models.CharField(default="{}", max_length=6000)
    Power = models.IntegerField(default=0)
    Status = models.IntegerField(default=0)
    CurScore = models.IntegerField(default=0)
    CurHookElement = models.CharField(default="{}", max_length=255)
    StoryId = models.IntegerField(default=0)
    CreateTime = models.DateTimeField(default="2010-01-01 00:00:00")


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishMemberAssist(BaseChaosModel):
    AssistId = models.CharField(max_length=32, primary_key=True)
    ActivityId = models.CharField(indexed=True, max_length=32)
    RoleGuid = models.CharField(indexed=True, max_length=32)
    ServerId = models.IntegerField()
    GiveType = models.IntegerField()
    GiveRoleGuid = models.CharField(max_length=32)
    GiveServerId = models.IntegerField()
    GiveElementId = models.IntegerField()
    AddPower = models.IntegerField()
    UseItem = models.CharField(max_length=255)
    IsReceive = models.IntegerField()
    CreateTime = models.DateTimeField(default="2010-01-01 00:00:00")


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishPersonAchieve(BaseChaosModel):
    ActivityId = models.CharField(max_length=32, primary_key=True)
    RoleGuid = models.CharField(max_length=32, primary_key=True)
    TaskType = models.IntegerField(primary_key=True)
    Count = models.IntegerField()


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishAlliesAchieve(BaseChaosModel):
    ActivityId = models.CharField(max_length=32, primary_key=True)
    AlliesId = models.CharField(max_length=32, primary_key=True)
    CountryId = models.IntegerField(primary_key=True)
    TaskType = models.IntegerField(primary_key=True)
    Count = models.IntegerField()


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishMapTask(BaseChaosModel):
    RoleGuid = models.CharField(max_length=32, primary_key=True)
    MapId = models.IntegerField(primary_key=True)
    ElementType = models.IntegerField(primary_key=True)
    Count = models.IntegerField()


@datasource_register(datasource=CrossFishActivityDatasource)
class TbCrossFishMapTaskRole(BaseChaosModel):
    RoleGuid = models.CharField(max_length=32, primary_key=True)
    TaskStatus = models.CharField(max_length=1024, default='{}')
    MapStatus = models.CharField(max_length=255, default='[]')
    AllMapStatus = models.IntegerField(default=0)


@datasource_register(datasource=CrossFishActivityDatasource)
@register_for_table_ver()
class TbCrossFishAchievementCfg(BaseChaosModel):
    TemplateId = models.IntegerField(primary_key=True)
    TaskClass = models.IntegerField(primary_key=True)
    TaskType = models.IntegerField(primary_key=True)
    CountData = models.CharField(default="[]", max_length=500)
    AwardList = models.CharField(default="[]", max_length=2500)
